package com.example.mobile2021606177cke0615;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MySQLiteOpenHelper extends SQLiteOpenHelper {
    public MySQLiteOpenHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table CarPeccancy(id integer primary key autoincrement, carnumber Text, pcode Text, pdatetime Text, paddr Text)";
        db.execSQL(sql);
        String sql2 = "create table Sense(id integer primary key autoincrement, Co2 integer, Pm25 integer, LightIntensity integer, humidity integer, temperature integer)";
        db.execSQL(sql2);
        String sql3 = "create table CarInfor(id integer primary key autoincrement, carnumber Text, number Text, pcardid Text, buydata Text, carbrand Text)";
        db.execSQL(sql3);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
